<template>
  <!-- 普通弹窗 -->
  <view>
    <uni-popup ref="stockPopup" background-color="#fff" :is-mask-click="false">
      <view class="popup-content">
        <image class="close" src="/static/images/x.png" mode="widthFix" @click="closePopup" />
        <view>{{ text1}}</view>
        <view>{{ text2}}</view>
        <view class="button" @click="closePopup">确定</view>
      </view>
    </uni-popup>
  </view>
</template>

<script>
  export default {
    name: 'stockPopup',
    props: {
      text1: {
        type: String,
        default: '商品库存发生变化',
      },
      text2: {
        type: String,
        default: '请尝试刷新后继续购买',
      },
    },
    data() {
      return {}
    },
    mounted() {},
    methods: {
      openPopup() {
        this.$refs.stockPopup.open()
      },
      closePopup() {
        this.$refs.stockPopup.close()
        this.$emit('close')
      },
    },
  }
</script>

<style lang="scss" scoped>
  .popup-content {
    width: 600rpx;
    box-sizing: border-box;
    background: #fff;
    padding: 30rpx 40rpx;
    position: relative;
    border-radius: 2rpx;
    font-size: 28rpx;
    color: #545454;
    text-align: center;

    .close {
      width: 30rpx;
      height: 30rpx;
      position: absolute;
      right: 30rpx;
      top: 30rpx;
    }

    .button {
      width: 100%;
      height: 70rpx;
      background: var(--main-color);
      border-radius: 2rpx;
      color: #fff;
      font-size: 28rpx;
      text-align: center;
      line-height: 70rpx;
      margin-top: 60rpx;
    }
  }
</style>